﻿Imports System.Data.SqlClient

Namespace SchoolClick.Database.UDT
    Public Class UDT_MATRICULA_RESPONSABLES

        Private _Table As DataTable
        Public Sub New()
            _Table = New DataTable

            'Definimos las columnas que lleva nuestra tipo de dato definido
            _Table.Columns.Add("NOMBRES", GetType(String))
            _Table.Columns.Add("APELLIDOS", GetType(String))
            _Table.Columns.Add("DUI", GetType(String))
            _Table.Columns.Add("TELEFONO", GetType(String))
            _Table.Columns.Add("PROFESION", GetType(String))
            _Table.Columns.Add("EMAIL", GetType(String))
            _Table.Columns.Add("EMPRESA", GetType(String))
            _Table.Columns.Add("DIRECCION", GetType(String))
            _Table.Columns.Add("PARENTESCO", GetType(String))
            _Table.Columns.Add("ISRESPONSABLE", GetType(Boolean))
            _Table.Columns.Add("ISFALLECIO", GetType(Boolean))
        End Sub

        Public Sub Insert(nombre As String, apellidos As String, dui As String, telefono As String, profesion As String, email As String, empresa As String, direccion As String, parentesco As String, isresponsable As Boolean, isfallecio As Boolean)
            _Table.Rows.Add(nombre.ToInitCap, apellidos.ToInitCap, dui, telefono, profesion, email, empresa, direccion, parentesco, isresponsable, isfallecio)
        End Sub

        Public Sub Insert(nombre As String, apellidos As String, parentesco As String)
            Me.Insert(nombre, apellidos, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, parentesco, False, True)
        End Sub

        Public Function GetSQLParameter() As SqlParameter
            Dim _param As New SqlParameter("RESPONSABLES", SqlDbType.Structured)
            _param.TypeName = "AdminINCA.M_RESPONSABLES"
            _param.Value = Me._Table

            Return _param
        End Function

        Public Overrides Function ToString() As String
            Return "EXEC [AdminINCA].[MATRICULA_NUEVA_SOLICITUD] @IDGRADO, @NOMBRES, @APELLIDOS, @GENERO, @NIE, @DUI, @IDPAIS, @FECHA_NAC, @ISPARVULARIA, @IDINSTITUTO, @DIRECCION, @IDDEPARTAMENTO, @IDMUNICIPIO, @TELEFONO, @CELULAR, @EMAIL, @NOMIEMBROS, @ISTRABAJA, @ISHIJOS, @ENFERMEDADES, @MEDICAMENTO, @ANIOANTERIOR, @UBICACIONGEOGRAFICA, @VIVECON, @ANIOCURSOUG, @RESPONSABLES, @NOSOLICITUD OUTPUT"
        End Function
    End Class
End Namespace
